<%@ page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<%@ include file="/common/import.jsp"%>
		<script type="text/javascript" src="${ctx}/js/zbxtools.js"></script>
		<script type="text/javascript" src="${ctx}/js/date.js"></script>
		<script>
	var thsTitle = "我的消息列表";
	var userEname ="${loginUser.userEname}";
	$(function() {
		$('#list').datagrid({
				iconCls : 'icon-ok',
				url : '${ctx}/notice.do?doCode=Mpages&toUserEname='+userEname,
				nowrap: false,
				striped: true,
				collapsible:false,				
				fitColumns:true,
				pagination:true,
				singleSelect:true,
				rownumbers:true,
				remoteSort: false,
				pageList:[15,20,30,50],
				idField : 'noticeId',
				columns : [ [
					{field : 'noticeTitle',title : '消息标题',align : 'left',width : 300,
					    formatter : function(val,rowData) {
							return "<a href='javascript:void(0);' onclick=\"showPublicIpDialog('"+rowData.noticeId+"');\">"+val+"</a>";
						}
					}, 
					{field : 'createdTime',title : '接收时间',align : 'center',width : 150,
						formatter : function(val) {
							return getSmpFormatDateByLong(val.time,null);
						}
					}, 
					{field : 'fromUserCname',title : '发送人',align : 'center',width : 150},
					{field : 'noticeType',title : '操作',align : 'center',width : 150,
						formatter : function(val,rowData) {
							return goUrl(val,rowData.objId);
						}
					},
					{field : 'noticeStatus',title : '当前状态',align : 'center',width : 100,
							formatter : function(val) {
								if("1"==val)
								return "已查看";
								else
								return "未查看";
							}
			 } ] ]
		});
	});
</script>
	</head>
	<body class="home-template">
		<!-- 正文开始 -->
		<div title="我的消息" class="easyui-panel" collapsible="true">
			<table id="list"></table>
		</div>
		<!-- 正文结束 -->
		<%@ include file="/common/top.jsp"%>
		
		<script type="text/javascript">
		function showPublicIpDialog(noticeId){ 
	     $.ajax({url:'${ctx}/notice.do?doCode=Mview&noticeId='+noticeId,type: 'POST',cache: false,async:false,dataType:'json',
			success: function(data){
			   $("#view_noticeTitle").html("<h3>"+data.noticeTitle+"</h3>");
			   $("#view_noticeContent").html(data.noticeContent); 
	            $('#list').datagrid("reload");
	            $('#dddwwwe').window('open');
			} 
		  });
	    }
		function goUrl(noticeType,objId){
			var rtet = "";
			if(noticeType == 'packReturn'){//包审核不通过
				rtet = "<a href='${ctx}/utr/pack/modify.action?packId="+objId+"'>资产包修改</a>";
			}else if(noticeType == 'medita'){
			    rtet = "<a href='${ctx}/utr/info/medita!list.action'>纸媒预约列表</a>";
			}else if(noticeType=="proReturn"){
			    rtet = "<a href='${ctx}/utr/pro/modify.action?proId="+objId+"'>项目修改</a>";
			}
			return rtet;
		}
		</script>
	   <div title="我的消息" id="dddwwwe" class="easyui-window"  style="padding:5px;width: 580px; height:350px; overflow: hidden;"
    	iconCls="icon-search" closed="true" maximizable="false" minimizable="false" collapsible="false">
		   <table width="100%" >
		    <tr><td align="center" id="view_noticeTitle"></td></tr>
		    <tr><td align="center" id="view_noticeContent"></td></tr>
		  </table>
	   </div>
	</body>
</html>